package com.hanson.security.controller;

/**
 * @author Hanson
 * @date 2022/12/9 13:54
 */
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @GetMapping("hello")
    public String hello() {
        return "hello spring security";
    }

    @GetMapping("index")
    public Object index(){
        return SecurityContextHolder.getContext().getAuthentication();
    }

//    @GetMapping("index")
//    public Object index(Authentication authentication) {
//        return authentication;
//    }
}
